package it.trekker.rest;

import it.trekker.dao.IUserDAO;
import it.trekker.dao.User;

import javax.annotation.ManagedBean;
import javax.ejb.EJB;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;

@Path("/user")
@ManagedBean
public class UsersREST {
	
	@EJB
	IUserDAO userDAO;

	@GET
	@Path("/{username}")
	public Response showUser(@PathParam("username") String username) {
		
		User user = userDAO.findUserByName(username);
		
		String result = "User => " + user.toString();
		
		return Response.status(200).entity(result).build();
	}
}
